$(function () {

    $('#new-msg').validator(
        {
            onValid: function (validity) {
                $(validity.field).closest('.am-form-group').find(
                    '.am-alert').hide();
            },

            onInValid: function (validity) {
                var $field = $(validity.field);
                var $group = $field.closest('.am-form-group');
                var $alert = $group.find('.am-alert');

                var msg = $field.data('validationMessage')
                    || this.getValidationMessage(validity);

                if (!$alert.length) {
                    $alert = $('<div class="am-alert am-alert-danger"></div>')
                        .hide().appendTo($group);
                }

                $alert.html(msg).show();
            }
        });


    $('#edit-msg').validator(
        {
            onValid: function (validity) {
                $(validity.field).closest('.am-form-group').find(
                    '.am-alert').hide();
            },

            onInValid: function (validity) {
                var $field = $(validity.field);
                var $group = $field.closest('.am-form-group');
                var $alert = $group.find('.am-alert');

                var msg = $field.data('validationMessage')
                    || this.getValidationMessage(validity);

                if (!$alert.length) {
                    $alert = $('<div class="am-alert am-alert-danger"></div>')
                        .hide().appendTo($group);
                }

                $alert.html(msg).show();
            }
        });

});//

function del(obj) {
    $('#my-confirm').modal({
        relatedTarget: this,
        onConfirm: function (options) {
            var delId = $(obj).attr("rel");
            window.location.href = "noticeDel.jsp?NoticeID=" + delId;
        },
        onCancel: function () {
        }
    });
}

function edit(obj) {
    var _obj = $(obj);
    var AdminPwd = _obj.prev().val();
    var AdminName = _obj.prev().prev().val();
    var AdminId = _obj.prev().prev().prev().val();
    $('#upd_AdminPwd').val(AdminPwd);
    $('#upd_AdminName').val(AdminName);
    $('#adminId').val(AdminId);
    $('#edit-popup').modal();
}